<template>
    <div class="message">
        <div class="head_portrait" @click="myMsg">
            <van-image width="100%" height="100%" fit="cover" :src="headerImg" />
        </div>
        <div class="msg_name">
            {{ userName }}
        </div>
        <div class="msg_id">ID: {{ userId }}</div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { useStore } from 'vuex';
const store = useStore();
let userName = store.state.user.userName;
let userId = store.state.user.userId;
defineProps({
    headerImg: String,
});
let emit = defineEmits(['openMsg']);
const myMsg = () => {
    emit('openMsg');
};
</script>

<style lang="scss" scoped>
@import '../../../style/base.scss';
.message {
    box-sizing: border-box;
    position: relative;
    margin: 1rem auto 0.16rem;
    padding-top: 0.59rem;
    width: 3.39rem;
    height: 1.55rem;
    background: #ffffff;
    box-shadow: 0 0.08rem 0.16rem 0 rgba(0, 0, 0, 0.08);
    border-radius: 0.08rem;
    .head_portrait {
        display: block;
        width: 0.94rem;
        height: 0.94rem;
        border-radius: 50%;
        background-color: teal;
        position: absolute;
        top: -0.47rem;
        left: -0.47rem;
        margin-left: 50%;
        overflow: hidden;
    }
    .msg_name {
        width: 100%;
        height: 0.36rem;
        font-family: PingFangSC-Regular;
        font-size: 0.24rem;
        color: #262628;
        text-align: center;
        line-height: 0.36rem;
    }
    .msg_id {
        margin-top: 0.02rem;
        width: 100%;
        height: 0.17rem;
        font-family: PingFangSC-Regular;
        font-size: 0.14rem;
        color: #c1c0c9;
        text-align: center;
    }
}
</style>
